import React, { Component } from 'react'
import Select from './components/Select'
import Tv from './components/Tv'
import Movie from './components/Movie'
import Me from './components/Me'
import Tabbar from './components/Tabbar'

export default class App extends Component {
    state ={
        list:[
            {
                id:0,
                neirong: '电视'
            },
            {
                id:1,
                neirong: '电影'
            },
            {
                id:2,
                neirong: '音乐'
            }
        ],
        current:0
    }
    which(){
        if(this.state.current === 0)
            return <Tv></Tv>
        else if(this.state.current === 1)
            return <Movie></Movie>
        else if(this.state.current === 2)
            return <Me></Me>
    }
  render() {
    return (
      <div>
          <Tabbar event={()=>{
              this.setState({
                  current:2
              })
          }}></Tabbar>
          {this.which()}
          <Select 
          list = {this.state.list} 
          current={this.state.current} 
          event={(index)=>{
            this.setState({
                current:index
            })
          }}></Select>
      </div>
    )
  }
}
